/*
 * @Author: XieQiu 雪球
 * @Date: 2021-05-20 10:47:33
 * @LastEditTime: 2024-05-08 10:07:24
 * @LastEditors: Please set LastEditors
 * @Description: 羊只管理接口 sheep-information
 */
import xjaxios from "@/api/axios";

export default {
  /**
   * @description: 获取羊只列表 *代表必填
   * @param {String/Number} page *
   * @param {String/Number} size *
   * @param {Object} entity {componyId: 1} *
   * @param {String} order 排序方式 ASC DESC 默认ASC
   * @param {String} sort 自定义排序方式 'createTime'
   * @return {Array}
   */
  getList(params) {
    return xjaxios.post("sheep/sheep/queryPageByCondition", params);
  },

  getSheepBirthRecordList(params) {
    return xjaxios.post('/sheep/sheep/queryPageGenerateRecordsPageParam', params)
  },
  // /**
  //  * @description: 条件查询所有羊只
  //  * @param null *
  //  * @return {Object}
  //  */
  getByCondition(params) {
    return xjaxios.post("sheep/sheep/queryByCondition", {
      organizationNo: sessionStorage.organizationNo,
      groupFlag: true,
      ...params
    });
  },
  getByNo(no) {
    return xjaxios.get(`sheep/sheep/queryByNo?no=${no}`);
  },
  // /**
  //  * @description: 条件查询所有羊只
  //  * @param null *
  //  * @return {Object}
  //  */
  getStaffListByCondition(params) {
    return xjaxios.post("organization/personDepartmentMapper/queryByCondition", {
      organizationNo: sessionStorage.organizationNo,
      personNo: params
    });
  },
  // /**
  //  * @description: 条件查询所有栋舍
  //  * @param null *
  //  * @return {Object}
  //  */
  getfacilityByCondition(params) {
    return xjaxios.post("breedFacility/facility/queryByCondition", {
      organizationNo: sessionStorage.organizationNo,
      ...params
    });
  },
  /**
   * @description: 新增羊只信息
   * @param {Object} formData *
   * @return {Object}
   */
  add(formData) {
    // formData.organizationNo = sessionStorage.baseId;
    return xjaxios.post("sheep/sheep/add", {
      organizationNo: sessionStorage.organizationNo,
      ...formData
    });
  },
  /**
   * @description: 编辑羊只信息
   * @param {Object} formData *
   * @return {Object}
   */
  edit(formData) {
    return xjaxios.post("sheep/sheep/update", formData);
  },
  /**
   * @description: 单个删除
   * @param {String} employeeId *
   * @return {Array}
   */
  del(no) {
    return xjaxios.get(`sheep/sheep/delByNo?no=${no}`);
  },
  delList(noList) {
    return xjaxios.post(`sheep/sheep/delListByNo`, { noList: noList });
  },
  // 上传excel
  employeeImportExcel(fileFormData) {
    return xjaxios.post('sheep/sheep/xlsUpdate', fileFormData)
  },
  // 下载excel
  exportDownExcel(params) {
    return xjaxios.get(`sheep/sheep/export?breedTypeNo=${sessionStorage.breedTypeNo}&organizationNo=${sessionStorage.organizationNo}`, params, { responseType: 'arraybuffer' });
  },
  // 种样选留记录查询
  querySelectRetainRecord(params) {
    return xjaxios.post('/sheep/sheep/querySelectRetainRecord', params)
  },
  // 种羊修改
  editBreedSheep(params) {
    return xjaxios.post('/sheep/sheep/editBreedSheep', params)
  },
  // 栏舍编号查询羊只数量普通
  queryColumnSheepCount(params) {
    return xjaxios.get(`/sheep/sheep/queryQuantityByColumnNo?columnNo=${params}`)
  },
  // 育肥批次
  queryfattenBatch(params) {
    return xjaxios.post(`/fattenBatch/fattenBatch/queryPageByCondition`, {
      "page": 1,
      "size": 10000,
      "entity": {
        ...params
      }
    })
  },
  //水产养殖批次查询
  queryFishBatch(params) {
    return xjaxios.post(`/fish/batch/batch/queryByCondition`, {
      ...params
    })
  },
  //水产养殖批次查询
  queryFishBatchPond(batchCode) {
    console.log(batchCode)
    return xjaxios.post(`/fish/batch/batchPond/queryByCondition`, {batchCode})
  },
  //条件查询设施
  queryFacility(facilityId) {
    return xjaxios.post(`/facility/facility/queryByCondition`, {facilityId})
  },
  // 种植批次查询
  queryPlateBatch(params) {
    return xjaxios.post(`/batch/productionBatch/queryByCondition`, {
      ...params
    })
  },
  // 批次信息查询
  queryPlateBatchByNo(params) {
    return xjaxios.get(`/batch/productionBatch/queryByNo?no=${params.no}`)
  },
  // 栏舍编号查询羊只数量育肥
  queryColumnBatchCount(params) {
    return xjaxios.get(`/fattenBatch/batchHouse/queryNumber?no=${params}`)
  },
  // 栋栏舍查询符合配种条件的母羊
  fenceQueryAllBreedingFemaleSheep(params) {
    return xjaxios.get(`/warning/tuppingOutlier/querySheepInfoByNo?no=${params}&breedTypeNo=${sessionStorage.breedTypeNo}&organizationNo=${sessionStorage.organizationNo}`)
  },
  // 耳标查羊只
  queryByEarLabel(params) {
    return xjaxios.get(`sheep/sheep/queryByEarLabel?no=${params}`);
  },
  getByCondition1(params) {
    return xjaxios.post("sheep/sheep/queryByCondition", {
      organizationNo: sessionStorage.organizationNo,
      ...params
    });
  }
};
